package com.yang.provider.manager;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yang.provider.entity.User;
import com.yang.provider.mapper.UserMapper;
import com.yang.common.dto.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author ：YangRan
 * @date ：Created in 2021/10/31 17:06
 * @description：userManager
 * @modified By：
 * @version: 1.0
 */
@Component
public class UserManager extends ServiceImpl<UserMapper, User> {

    @Autowired
    private UserMapper userMapper;

    public ResultVO<User> getUserByNameAndPassword(String loginName, String password) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("login_name", loginName);
        queryWrapper.eq("password", password);
        User user = userMapper.selectOne(queryWrapper);
        return ResultVO.success(user);
    }

}
